package Thread_;

class MyThread01 extends Thread{
    @Override
    public void run() {
        //run()方法就是该线程的入口
        while (true){
            System.out.println("Thread run");
            try {
                Thread.sleep(1000);
            } catch (InterruptedException e) {
                throw new RuntimeException(e);
            }
        }
    }
}
public class Thread01 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread01 = new MyThread01();
        thread01.start();//必须要调用start()方法,才能开启线程
//        thread01.start();

        while(true){
        System.out.println("main ");
          Thread.sleep(1000);
        }
    }
}








